﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace DarkLight.WpfTest
{
    public class TypeTemplateSelector : DataTemplateSelector
    {
        private List<DataTemplate> _templates = new List<DataTemplate>();

        public List<DataTemplate> Templates { get { return _templates; } }

        public override DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            return Templates.FirstOrDefault(e => e.DataType as Type == item.GetType());
        }
    }
}
